package org.lee.validate.vo.request;

import lombok.Data;
import lombok.ToString;
import org.lee.validate.custom.annotation.Age;
import org.lee.validate.custom.group.Insert;
import org.lee.validate.custom.group.Update;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * HelloRequest
 *
 * @author dralee
 * @date 2021-12-24 14:49:30
 **/
@Data
@ToString
public class HelloRequest {

    @NotNull(message = "用户id不能为空", groups = Update.class) // 更新时验证
    private Integer id;

    @NotBlank(message = "姓名不能为空", groups = {Insert.class, Update.class}) // 新增、更新都验证
    private String name;

    @Age
    private int age;
}
